# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Contributor: Ionut Biru <ibiru@archlinux.org>

pkgbase=gtkmm3
pkgname=(gtkmm3 gtkmm3-docs)
pkgver=3.24.5
pkgrel=2
pkgdesc="C++ bindings for GTK+ 3"
url="https://www.gtkmm.org/"
arch=(x86_64)
license=(LGPL)
depends=(gtk3 pangomm atkmm)
makedepends=(git meson mm-common glibmm-docs cairomm-docs pangomm-docs
             atkmm-docs)
checkdepends=(xorg-server-xvfb)
options=(!emptydirs)
_commit=46ba619fae503e361d088991f5eb8cf0b2c343fc  # tags/3.24.5^0
source=("git+https://gitlab.gnome.org/GNOME/gtkmm.git#commit=$_commit")
sha256sums=('SKIP')

pkgver() {
  cd gtkmm
  git describe --tags | sed 's/-/+/g'
}

prepare() {
  cd gtkmm
}

build() {
  arch-meson gtkmm build -D maintainer-mode=true
  meson compile -C build
}

check() {
  xvfb-run -s '-nolisten local' meson test -C build --print-errorlogs
}

package_gtkmm3() {
  depends+=(libsigc-2.0.so libglibmm-2.4.so libcairomm-1.0.so libpangomm-1.4.so
            libatkmm-1.6.so)
  provides=(libgtkmm-3.0.so)

  meson install -C build --destdir "$pkgdir"

  # Split -docs
  mkdir -p docs/usr/share
  mv -t docs/usr/share "$pkgdir"/usr/share/{devhelp,doc}
}

package_gtkmm3-docs() {
  pkgdesc+=" (documentation)"
  depends=()
  options=(!strip)

  mv -t "$pkgdir" docs/*
}
